import request from "api";

export function getAllProjects(page){
    return request({
        url:"projects/getAllProjects",
        method:"get",
        params:{
            PageIndex:page.index,
            PageSize:page.PageSize
        }
    })
}

export function getAllTeacAndPro(){
    return request({
        url:"projects/add",
        method:"get"
    })
}

export function deleteProject(Id){
    return request({
        method:"delete",
        url:"/projects/delete",
        params:{
            Id
        }
    })
}

export function addProject(form){
    return request({
        url:"projects/add",
        method:"post",
        data:{
            caption:form.caption,
            major:form.major+"",
            dll_name:form.dll_name,
            principle:form.principle+"",
            devices: form.devices && form.devices.join(","),
            description:form.description,
            enable:form.enable*1,
            id:form.id,
        }
    })
}

export function editProject(form){
    return request({
        method:"post",
        url:"projects/modify",
        data:{
            caption:form.caption,
            major:form.major+"",
            dll_name:form.dll_name,
            principle:form.principle+"",
            devices: form.devices && form.devices.join(","),
            description:form.description,
            enable:form.enable*1,
            id:form.id,
        }
    })
}

